
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="renderer" content="webkit" />
<title>主页</title>

<link rel="stylesheet" type="text/css" href="../../../plugins/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/jquery-easyui/1.8.6/themes/bootstrap/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/jquery-easyui/1.8.6/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="../../../plugins/font-awesome/css/font-awesome.min.css" />
    
<link rel="stylesheet" href="../../../plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css" media="all" />
    
<link rel="stylesheet" type="text/css" href="../../../plugins/codemirror/lib/codemirror.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/codemirror/theme/dracula.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/codemirror/addon/hint/show-hint.css" />
<link rel="stylesheet" type="text/css" href="../../../plugins/codemirror/addon/display/fullscreen.css">
<link rel="stylesheet" type="text/css" href="../../../plugins/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" type="text/css" href="../../../plugins/codemirror/addon/search/matchesonscrollbar.css">
    
<link rel="stylesheet" type="text/css" href="../../../css/zbootstrap.css" />
<link rel="stylesheet" type="text/css" href="../../../css/zeasyui.css" />
<link rel="stylesheet" type="text/css" href="../../../css/common.css" />
    
<script type="text/javascript" src="../../../plugins/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="../../../plugins/jquery-rstorage/1.3.2/jquery.rStorage.min.js"></script>
<script type="text/javascript" src="../../../plugins/jquery-easyui/1.8.6/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../../plugins/jquery-form/4.3.0/jquery.form.min.js"></script>
    
<script type="text/javascript" src="../../../plugins/zTree_v3/js/jquery.ztree.all.js"></script>
<script type="text/javascript" src="../../../plugins/zTree_v3/js/jquery.ztree.exhide.js"></script>
    
<script type="text/javascript" src="../../../plugins/codemirror/lib/codemirror.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/mode/clike/clike.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/mode/xml/xml.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/mode/css/css.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/mode/sql/sql.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/xml-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/show-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/sql-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/html-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/css-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/javascript-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/hint/anyword-hint.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/selection/selection-pointer.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/display/autorefresh.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/display/placeholder.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/edit/matchbrackets.js"></script>
<script type="text/javascript" src="../../../plugins/codemirror/addon/display/fullscreen.js"></script>
    
<script type="text/javascript" src="../../../js/zGlobal.js"></script>
<script type="text/javascript" src="../../../js/zApi.js"></script>
<script type="text/javascript" src="../../../js/zUtil.js"></script>
<script type="text/javascript" src="../../../js/zAlert.js"></script>
<script type="text/javascript" src="../../../js/zDict.js"></script>
<script type="text/javascript" src="../../../js/zTable.js"></script>
<script type="text/javascript" src="../../../js/zDialog.js"></script>
<script type="text/javascript" src="../../../js/zForm.js"></script>
    
    <![if IE]>

    <![endif]>

</head>
<body onload="noright(document.body);">

    <div id="p-all" class="easyui-layout" data-options="fit:true,border:false," style="border: 0px solid #D8D9E5;"> 
     <div data-options="region:'center',split:false,border:false,minWidth:200" style="overflow: hidden;width:50%;border-right:1px solid rgb(210, 208, 208);"> 
       <div style="height: 36px;padding:5px 3px;position: absolute;z-index: 2;right: 2px;">
        <input id="table-toggle" class="easyui-switchbutton" style="" />
       </div> 
      <table id="table-left"></table> 
     </div> 
     <div data-options="region:'east',split:true,border:false,minWidth:200" style="overflow: hidden;width:50%;border-left:1px solid rgb(210, 208, 208);"> 
      <table id="table-right"></table> 
     </div> 
    </div> 

  <!---分割-------------------------------------------------------------------------------->
  <div id="dlg-add-left" style="display:none;"> 
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div> 
     <div class="row padding-right"> 
     <div class="col-sm-12"> 
          <div class="row" style="padding: 3px;"> 
           <fieldset style="border: 1px solid #e5e5e5;padding-bottom: 5px;"> 
              <legend class=" text-info">说明</legend>
              <span class="description-title">上传模板：</span><span class="description-text">创建记录后使用列表的<i class="fa fa-upload" style="color: blue;">上传</i>模板，上传完成后再使用<i class="fa fa-refresh" style="color: blue;">同步模板文件</i>保存模板明细</span><br>
              <span class="description-title">模板内容：</span><span class="description-text">具体内容按需要设计,数据对象在<i class="fa" style="color: blue;">"代码生成配置->选择右侧记录->代码生成信息/代码生成设计"</i>编写和查看</span><br>
              <span class="description-title">模板文件命名规则：</span><span class="description-text">[引用编码,生成文件格式,模板类型,排序] xxx.ftl。快捷引用编码: 方法的req，res；表的entity，entityVo，dao，resBase，resBase2</span>
           </fieldset>
          </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="required:true,prompt:'可直接选模块'" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属模块</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="moduleId" name="moduleId" data-options="required:true,prompt:'可直接选模块'" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="templateTitle" name="templateTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     
     </div> 
    </form> 
   </div> 
  </div>


  <div id="dlg-edit-left" style="display:none;"> 
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板主键ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="templateId" name="templateId" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属模块</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="moduleId" name="moduleId" data-options="required:true" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="templateTitle" name="templateTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板根路径</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="templatePath" name="templatePath" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">状态</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="dataStatus" name="dataStatus" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createOprid" name="createOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createName" name="createName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createTm" name="createTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdOprid" name="lastUpdOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdName" name="lastUpdName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdTm" name="lastUpdTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>

  <div id="dlg-query-left" style="display:none;">
   <div class="main-content">
    <form>
     <div class="row padding-right">
     <div class="col-sm-12"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">所属模块</label> 
      <div class="input-block">
        <select class="easyui-combobox" id="moduleId" name="moduleId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">模板主键ID</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="templateId" name="templateId" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">模板标题</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="templateTitle" name="templateTitle" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form>
   </div>
  </div>
  <!---分割-------------------------------------------------------------------------------->
  <div id="dlg-add-right" style="display:none;">
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <div class="col-sm-12"> 
          <div class="row" style="padding: 3px;"> 
           <fieldset style="border: 1px solid #e5e5e5;padding-bottom: 5px;"> 
              <legend class=" text-info">说明</legend>
              <span class="description-text">一般无需单独新增，可以使用<i class="fa fa-refresh" style="color: blue;">同步模板文件</i>批量保存文件记录。模板可以
              <i class="fa fa-eye" style="color: blue;">在线编辑</i></span>
           </fieldset>
          </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属模块</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="moduleId" name="moduleId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属模板</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="templateId" name="templateId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">文件标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="fileTitle" name="fileTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">文件名称</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="fileName" name="fileName" data-options="required:true,prompt:'完整文件名称,例如：test.ftl'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板引用名</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="quoteTag" name="quoteTag" data-options="required:true,validType : ['letterNum'],prompt:'例如：controller，impl...'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">输出文件格式</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="outputFileFormat" name="outputFileFormat" data-options="required:true,validType : ['letterNum'],prompt:'例如：java，js...'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="outputType" name="outputType" data-options="required:true,panelHeight:250" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>
  
  <div id="dlg-edit-right" style="display:none;">
   <div class="main-content"> 
    <form>
     <div class="row">&nbsp;</div>
     <div class="row padding-right"> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板明细ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="templateFileId" name="templateFileId" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属项目</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="projectId" name="projectId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属模块</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="moduleId" name="moduleId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">所属模板</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="templateId" name="templateId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">文件标题</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="fileTitle" name="fileTitle" data-options="required:true" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">文件名称</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="fileName" name="fileName" data-options="required:true,prompt:'完整文件名称,例如：test.ftl'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板引用名</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="quoteTag" name="quoteTag" data-options="required:true,validType : ['letterNum'],prompt:'例如：controller，impl...'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">输出文件格式</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="outputFileFormat" name="outputFileFormat" data-options="required:true,validType : ['letterNum'],prompt:'例如：java，js...'" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">模板类型</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="outputType" name="outputType" data-options="required:true,panelHeight:250" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">排序</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="orderNum" name="orderNum" data-options="validType : ['number']" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">备注</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="remarks" name="remarks" data-options="multiline:true,height:80" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">状态</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="dataStatus" name="dataStatus" data-options="" style="width:100%;" ></select>
      </div> 
     </div>
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createOprid" name="createOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createName" name="createName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">创建时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="createTm" name="createTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户ID</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdOprid" name="lastUpdOprid" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新用户</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdName" name="lastUpdName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-6"> 
      <label class="form-lable">更新时间</label> 
      <div class="input-block"> 
        <input class="easyui-textbox" id="lastUpdTm" name="lastUpdTm" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form> 
   </div> 
  </div>
  
  <div id="dlg-query-right" style="display:none;">
   <div class="main-content">
    <form>
     <div class="row padding-right">
<!--      <input id="templateId" name="templateId" type="hidden"/>  模板主键ID -->
     <div class="col-sm-12"> 
      <label class="form-lable">所属模板</label> 
      <div class="input-block"> 
        <select class="easyui-combobox" id="templateId" name="templateId" data-options="" style="width:100%;" ></select>
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">模板明细ID</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="templateFileId" name="templateFileId" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">文件标题</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="fileTitle" name="fileTitle" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">文件名称</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="fileName" name="fileName" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     <div class="col-sm-12"> 
      <label class="form-lable">模板引用名</label> 
      <div class="input-block">
        <input class="easyui-textbox" id="quoteTag" name="quoteTag" data-options="" style="width:100%;" /> 
      </div> 
     </div> 
     </div> 
    </form>
   </div>
  </div>


  <div id="dlg-file-left" style="display:none;">
   <div class="main-content">
     <div class="easyui-layout" data-options="fit:true,border:false">
       <div class="no-tip"data-options="region:'west',split:true,border:false,title:'已上传文件',expandMode:'dock'" style="overflow: hidden;width:350px;border-right:1px solid rgb(210, 208, 208);"> 
          <div class="overflow-y"><ul id="tree-code-file" class="ztree"></ul></div>
       </div>
       <div class="no-tip" data-options="region:'center',split:false,border:false,title:'文件内容'" style="overflow: hidden;width:auto;border-left:1px solid rgb(210, 208, 208);"> 
          <form enctype="multipart/form-data">
     <div class="row"> 
      <div class="col-sm-12"> 
       <label class="form-lable">上传文件</label> 
<!--        application/x-zip-compressed -->
        <input class="easyui-filebox" id="fileObj" name="fileObj" data-options="required:true,prompt:'zip,btl,ftl,vm,vtl,tlf,ejy',accept:'',accept:'',buttonText:'选择',validType:['fileSize[1,\'MB\']']" style="width:100%">
      </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12"> 上传zip将删除对应目录全部文件.
      </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12"> 单个文件上传为增量上传,同名覆盖.
      </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12" style="color: blue;"><p></p> 上传完成后：<a href="javascript:void(0);" class="easyui-linkbutton" onclick="dlgLoadFile();">同步模板明细</a>
      </div> 
      <div class="col-sm-12"> 使用同步功能，保存模板记录.
      </div> 
     </div>
     <div class="row" style="color: red;"> 
     <div class="col-sm-12" style="color: blue;"><p></p> 模板文件命名规则：
      </div> 
      <div class="col-sm-12">"[引用名,文件格式,模板类型,排序] xxx.ftl"
      </div> 
      <div class="col-sm-12" style="color: #72CC3F;">若不写"[xx]",保存明细时仍需填写。
      </div>
      <div class="col-sm-12" style="color: #72CC3F;">模板类型字典：template.outputType。
      </div>
      
     </div>
   </form>
       </div>
      </div>
   </div>
   
  </div>
    
  <div id="dlg-file-right" data-options="fit:true" style="display:none;">
   <div class="main-content">
   <form style="height:100%">
     <div style="height:100%;border-bottom: 1px solid #EEE;border-left: 1px solid #EEE;border-right: 1px solid #EEE;">
         <table id="table-file-right" data-options="fit:true"></table> 
     </div>
   </form>
   </div>
  </div>

  <div id="dlg-code-online-look" style="display:none;overflow: hidden;">
   <div class="main-content">
     <div style="height:100%;position: relative;border: 1px solid #D2D2D2;">
         <textarea id="fileContent" style="display: none;"></textarea>
      </div>
   </div>
  </div>

 <script>
  TableToggleFlag = true;//默认开启联动
  TableSelectFlag = null;//默认未选中
  DictNames = {};
  
  /* --分割------------------------------------------------------------------------------ */
  
  TitleLeft = "模板信息";
  IdDlgAddLeft = "#dlg-add-left";
  IdDlgEditLeft = "#dlg-edit-left";
  IdDlgQueryLeft = "#dlg-query-left";
  IdTableLeft = "#table-left";
  TableHeaderLeftMenu = null;
  
  /* --分割------------------------------------------------------------------------------ */
  
  TitleRight = "模板明细";
  IdDlgAddRight = "#dlg-add-right";
  IdDlgEditRight = "#dlg-edit-right";
  IdDlgQueryRight = "#dlg-query-right";
  IdTableRight = "#table-right";
  TableHeaderRightMenu = null;
  
  /* --分割------------------------------------------------------------------------------ */
  
  IdDlgFileLeft = "#dlg-file-left";
  IdDlgFileRight = "#dlg-file-right";
  IdTableFileRight = "#table-file-right";
  IdTableFileEditIdx = null;
  IdTableFileEditIdx2 = null;
  /* --分割------------------------------------------------------------------------------ */
  $(function(){
    loadDictToPage();//字典
    
    $('#table-toggle').switchbutton({
      checked:true,
      handleText:'明细',
      width:75,
      height:25,
      handleWidth:35,
      onChange:function(checked){
        if(checked){
          TableToggleFlag = true;
          $('#p-all').layout('expand','east');
        }else{
          TableToggleFlag = false;
          $('#p-all').layout('collapse','east');
        }
        $('#p-all .layout-expand.layout-expand-east').addClass('disabled');
      }
    });
    
    /* --分割------------------------------------------------------------------------------ */
    
    var urlLeft = zGlobal["http"] + "/autocode/template/list";
    var buttonsIdxLeft = [0,3,4];
    var buttonsFuncLeft = [dlgAddLeft,dlgDelLeftTemplate,dlgQueryLeft];
    var optionsLeft = {
            queryParams:{},
            url : urlLeft,
            idField: 'templateId',
            sortName: 'createTm',
            sortOrder: 'desc',
            multiSort: true,
            columns:[[
                {field: 'templateId', title: '模板主键ID', align: 'center', width: 100, hidden: true},
                {field: 'projectId', title: '所属项目', align: 'left',halign: 'center', width: 100,sortable: true, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"ZSELECT_PROJECT")}},
                {field: 'moduleId', title: '所属模块', align: 'left',halign: 'center', width: 100, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"ZSELECT_PROJECT_MODULE")}},
                {field: 'templatePath', title: '模板根路径', align: 'left',halign: 'center', width: 150},
                {field: 'orderNum', title: '排序', align: 'center', width: 50,sortable: true},
                {field: 'dataStatus', title: '状态', align: 'center', width: 50, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                {field: 'createName', title: '创建用户', align: 'center', width: 100},
                {field: 'createTm', title: '创建时间', align: 'center', width: 135,sortable: true},
                {field: ' ', title: ' ', align: 'center', width: 100},
            ]],
            frozenColumns:[[
//              {field:'', title:'', align:'center', checkbox:true},
             {field:'buttonArr', title:'操作', align:'center', width: 60, formatter:buttonsFormatterLeft},
             {field: 'templateTitle', title: '模板标题', align: 'left',halign: 'center', width: 160},
            ]],
            onDblClickCell: function(rowIndex, field, value){
                if("buttonArr" != field){
                    dlgDtlLeft(rowIndex);
                }
            },
            onSelect: function(rowIndex, rowData){
              if(TableToggleFlag && rowData['templateId'] != TableSelectFlag){
                TableSelectFlag = rowData['templateId'];
                zUtil.formClear(IdDlgQueryRight + ' form');
                zUtil.val(IdDlgQueryRight + ' #templateId',rowData['templateId']);
                zUtil.readonly(IdDlgQueryRight + ' #templateId');
                zUtil.tableQuery(IdTableRight,{
                  'templateId': rowData['templateId']
                },{url:urlRight});
              }
            },
            onHeaderContextMenu: function(e, field){
              TableHeaderLeftMenu = zUtil.tableHeaderMenu(e,TableHeaderLeftMenu,IdTableLeft);
            },
            onRowContextMenu: function(e, rowIndex, rowData){
              e.preventDefault();
              zUtil.tableSelected(IdTableLeft,rowIndex);
              if(rowData != null){
                  dlgEditLeft(rowData);
              }
            },
    };
    zUtil.tableInit(IdTableLeft,optionsLeft,buttonsIdxLeft,buttonsFuncLeft);
    
    
    /* --分割------------------------------------------------------------------------------ */
    var urlRight = zGlobal["http"] + "/autocode/templateDtl/list";
    var buttonsIdxRight = [0,4];
    var buttonsFuncRight = [dlgAddRight,dlgQueryRight];
    var optionsRight = {
            queryParams:{},
            url : '',
            idField: 'templateFileId',
            sortName: 'createTm',
            sortOrder: 'desc',
            multiSort: true,
            columns:[[
                {field: 'templateFileId', title: '模板明细主键ID', align: 'center', width: 100, hidden: true},
                {field: 'templateId', title: '模板主键ID', align: 'center', width: 100, hidden: true},
                {field: 'projectId', title: '所属项目', align: 'center', width: 100, hidden: true, formatter: function(value,rowData,rowIndex){return zUtil.dictConvertOfAutocode(value,"ZSELECT_PROJECT")}},
                {field: 'moduleId', title: '所属模块', align: 'center', width: 100, hidden: true, formatter: function(value,rowData,rowIndex){return zUtil.dictConvertOfAutocode(value,"ZSELECT_PROJECT_MODULE")}},
                {field: 'quoteTag', title: '模板引用名', align: 'left',halign: 'center', width: 100},
                {field: 'outputFileFormat', title: '输出文件格式', align: 'center', width: 100},
                {field: 'outputType', title: '模板类型', align: 'center', width: 100, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"template.outputType")}},
                {field: 'orderNum', title: '排序', align: 'center', width: 50,sortable: true},
                {field: 'dataStatus', title: '状态', align: 'center', width: 50, formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"dict.dataStatus")}},
                {field: 'createName', title: '创建用户', align: 'center', width: 100},
                {field: 'createTm', title: '创建时间', align: 'center', width: 135,sortable: true},
                {field: ' ', title: ' ', align: 'center', width: 100},
            ]],
            frozenColumns:[[
//              {field:'', title:'', align:'center', checkbox:true},
             {field:'buttonArr', title:'操作', align:'center', width: 60, formatter:buttonsFormatterRight},
             {field: 'fileTitle', title: '文件标题', align: 'left',halign: 'center', width: 100},
            ]],
            onDblClickCell: function(rowIndex, field, value){
                if("buttonArr" != field){
                    dlgDtlRight(rowIndex);
                }
            },
            onSelect: function(rowIndex, rowData){
            },
            onHeaderContextMenu: function(e, field){
              TableHeaderRightMenu = zUtil.tableHeaderMenu(e,TableHeaderRightMenu,IdTableRight);
            },
            onRowContextMenu: function(e, rowIndex, rowData){
              e.preventDefault();
              zUtil.tableSelected(IdTableRight,rowIndex);
              if(rowData != null){
                  dlgEditRight(rowData);
              }
            },
    };
    zUtil.tableInit(IdTableRight,optionsRight,buttonsIdxRight,buttonsFuncRight);
    
        
        
    /* --分割------------------------------------------------------------------------------ */
    
  });
  
  function loadDictToPage(){
      var returnHandler = function(dict){
          zDictAutocode = dict;
          DictNames['ZSELECT_PROJECT'] = 'projectId';
          DictNames['ZSELECT_PROJECT_MODULE'] = 'moduleId';
          DictNames['ZSELECT_TEMPLATE'] = 'templateId';
          DictNames['dict.dataStatus'] = 'dataStatus';
          DictNames['template.outputType'] = 'outputType';
          
          var linkSelsetIds = [IdDlgQueryLeft,IdDlgAddLeft,IdDlgEditLeft,IdDlgQueryRight,IdDlgAddRight,IdDlgEditRight];
          $.each(linkSelsetIds,function(i,item){
              zUtil.selectFill(item,DictNames,zDictAutocode);
              
              zUtil.inputInit(item +" #projectId",'select',{
                  onSelect: function(data){
                      if(!data){return;}
                      zUtil.selectClear(item +" #moduleId");
                      DictNames = {};
                      DictNames["ZSELECT_PROJECT_MODULE_"+data["value"]] = "moduleId";
                      zUtil.selectFill(item, DictNames, zDictAutocode);
                  },
                  onChange: function(newValue,oldValue){
                      if(newValue){return;}
                      zUtil.val(item +" #moduleId", null);
                      DictNames = {};
                      DictNames["ZSELECT_PROJECT_MODULE"] = "moduleId";
                      zUtil.selectFill(item, DictNames, zDictAutocode);
                  }
              });
              
              zUtil.inputInit(item +" #moduleId",'select',{
                  onSelect: function(data){
                      if(!data){return;}
                      zUtil.val(item +" #projectId",data['projectId']);
                  },
              });
          });
      };
      zUtil.dictLoadOfAutocode("dict.dataStatus,template.outputType,ZSELECT_PROJECT,ZSELECT_PROJECT_MODULE,ZSELECT_TEMPLATE"
          ,null,returnHandler);
  }
  
  /* --分割------------------------------------------------------------------------------ */
  
  //TODO
  function buttonsFormatterLeft(value,rowData,rowIndex){
    return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgDelLeft('+rowIndex+');" title="删除" ><i class="fa fa-trash"> </i></a> '
         +'<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgFileLeft('+rowIndex+');" title="上传/同步"><i class="fa fa-upload"> </i></a> '
         +'<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgLoadFile('+rowIndex+');" title="同步模板明细"><i class="fa fa-refresh"> </i></a> '
         ;
  }
  //TODO
  function dlgQueryLeft(){
    var dlgSave = function(){
      var params = zUtil.valAll(IdDlgQueryLeft);
      zUtil.tableQuery(IdTableLeft,params);
      zUtil.tableData(IdTableRight,[]);
      zUtil.tableUnSelected(IdTableLeft);
      TableSelectFlag = null;
    };
    var dlgClear = function(){
      zUtil.formClear(IdDlgQueryLeft + ' form');
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgQueryLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-查询',
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit(IdDlgQueryLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgQueryLeft);
  };
  //TODO
  function dlgQueryxLeft(){
    //zUtil.dialogOpen(IdDlgQueryxLeft);
  };
  //TODO
  function dlgAddLeft(){
    zUtil.formClear(IdDlgAddLeft + ' form');
    zUtil.readonlyAll(IdDlgAddLeft,false);
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgAddLeft +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgAddLeft);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/template/add", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          zUtil.tableQuery(IdTableLeft,params);
          zUtil.dialogClose(IdDlgAddLeft);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
      
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgAddLeft);
    };
    var dlgOptions = {
       title: TitleLeft + '-新增',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgAddLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen(IdDlgAddLeft);
  };
  //TODO  
  function dlgEditLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    
    zUtil.formClear(IdDlgEditLeft + ' form');
    zUtil.readonlyAll(IdDlgEditLeft,false);
    zUtil.readonly(IdDlgEditLeft + ' #templateId');
    zUtil.readonly(IdDlgEditLeft + ' #projectId');
    zUtil.readonly(IdDlgEditLeft + ' #templatePath');
    zUtil.readonly(IdDlgEditLeft + ' #dataStatus');
    zUtil.readonly(IdDlgEditLeft + ' #createOprid');
    zUtil.readonly(IdDlgEditLeft + ' #createName');
    zUtil.readonly(IdDlgEditLeft + ' #createTm');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdOprid');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdName');
    zUtil.readonly(IdDlgEditLeft + ' #lastUpdTm');
          
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgEditLeft +' form')){
        return false;
      }
      var params = zUtil.valAll(IdDlgEditLeft);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/template/edit", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          zUtil.tableQuery(IdTableLeft,params);
          zUtil.dialogClose(IdDlgEditLeft);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-编辑',
      onOpen : function(){
        var params = {};
        params['templateId']  = row['templateId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/template/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditLeft,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgEditLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditLeft);
  };
  //TODO
  function dlgDtlLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    zUtil.formClear(IdDlgEditLeft + ' form');
    zUtil.readonlyAll(IdDlgEditLeft);
          
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditLeft);
    };
    var dlgOptions = {
      title: TitleLeft + '-详情',
      onOpen : function(){
        var params = {};
        params['templateId']  = row['templateId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/template/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditLeft,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit(IdDlgEditLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditLeft);
  };
  //TODO
  function dlgDelLeft(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }
    
    var params = {}; 
    params['templateId']  = row['templateId'];
    var reqData = {reqData: params};
    var okfunc = function(){
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/template/del", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          zUtil.tableQuery(IdTableLeft,params);
        }else{
          zUtil.msg('操作失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    }
    zUtil.msgConfirm("确认删除已选中记录?",okfunc);
  };
  //TODO 
  function dlgDelLeftTemplate(){
    var row = zUtil.tableRows(IdTableLeft);
    if(!row){
        zUtil.msg('请先选择记录');
        return false;
    }
    var params = {}; 
    params['templateId']  = row['templateId'];
    var reqData = {reqData: params};
    var okfunc = function(){
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/template/delTemplateAndDetail", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryLeft);
          zUtil.tableQuery(IdTableLeft,params);
          zUtil.tableData(IdTableRight,[]);
        }else{
          zUtil.msg('操作失败');
          return false;
        }
      });
    }
    zUtil.msgConfirm("删除模板及模板明细?",okfunc);
  };
  /* --分割------------------------------------------------------------------------------ */
  //TODO
  function getTableLeft(){
      var rowLeft =  zUtil.tableRows(IdTableLeft);
      if(rowLeft == null || rowLeft.length == 0){
          zUtil.msg('未选择左侧数据');
          return null;
      }
      return rowLeft;
  }
  //TODO
  function buttonsFormatterRight(value,rowData,rowIndex){
    return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgDelRight('+rowIndex+');" title="删除" ><i class="fa fa-trash"> </i></a> '
         +' <a href="javascript:void(0)" class="easyui-linkbutton" onclick="dlgOnlineLookCode('+rowIndex+');" title="在线编辑" ><i class="fa fa-eye"> </i></a>';
  }
  //TODO
  function dlgQueryRight(){
    var rowLeft = getTableLeft();
    if(rowLeft == null){
      return false;
    };
    zUtil.readonly(IdDlgQueryRight + ' #projectId');
    zUtil.readonly(IdDlgQueryRight + ' #moduleId');
    zUtil.readonly(IdDlgQueryRight + ' #templateId');
    var dlgSave = function(){
      var params = zUtil.valAll(IdDlgQueryRight);
      zUtil.tableQuery(IdTableRight,params);
    };
    var dlgClear = function(){
      zUtil.formClear(IdDlgQueryRight + ' form');
      zUtil.val(IdDlgQueryRight + ' #templateId',rowLeft['templateId']);
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgQueryRight);
    };
    var dlgOptions = {
      title: TitleRight + '-查询',
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit(IdDlgQueryRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgQueryRight);
  };
  //TODO
  function dlgQueryxRight(){
    //zUtil.dialogOpen(IdDlgQueryxRight);
  };
  //TODO
  function dlgAddRight(){
    var rowLeft = getTableLeft();
    if(rowLeft == null){
      return false;
    };
    
    zUtil.formClear(IdDlgAddRight + ' form');
    zUtil.readonlyAll(IdDlgAddRight,false);
    zUtil.val(IdDlgAddRight + ' #projectId',rowLeft['projectId'])
    zUtil.val(IdDlgAddRight + ' #moduleId',rowLeft['moduleId'])
    zUtil.val(IdDlgAddRight + ' #templateId',rowLeft['templateId'])
    zUtil.readonly(IdDlgAddRight + ' #projectId');
    zUtil.readonly(IdDlgAddRight + ' #moduleId');
    zUtil.readonly(IdDlgAddRight + ' #templateId');
    
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgAddRight +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgAddRight);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/templateDtl/add", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
          zUtil.dialogClose(IdDlgAddRight);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgAddRight);
    };
    var dlgOptions = {
       title: TitleRight + '-新增',
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgAddRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen(IdDlgAddRight);
  };
  //TODO  
  function dlgEditRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    zUtil.formClear(IdDlgEditRight + ' form');
    zUtil.readonlyAll(IdDlgEditRight,false);
    zUtil.readonly(IdDlgEditRight + ' #templateFileId');
    zUtil.readonly(IdDlgEditRight + ' #projectId');
    zUtil.readonly(IdDlgEditRight + ' #moduleId');
    zUtil.readonly(IdDlgEditRight + ' #templateId');
    zUtil.readonly(IdDlgEditRight + ' #dataStatus');
    zUtil.readonly(IdDlgEditRight + ' #createOprid');
    zUtil.readonly(IdDlgEditRight + ' #createName');
    zUtil.readonly(IdDlgEditRight + ' #createTm');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdOprid');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdName');
    zUtil.readonly(IdDlgEditRight + ' #lastUpdTm');
          
    var dlgSave = function(){
      if(!zUtil.formCheck(IdDlgEditRight +' form')){
        return false;
      };
      var params = zUtil.valAll(IdDlgEditRight);
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/templateDtl/edit", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
          zUtil.dialogClose(IdDlgEditRight);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditRight);
    };
    var dlgOptions = {
      title: TitleRight + '-编辑',
      onOpen : function(){
        var params = {};
        params['templateFileId']  = row['templateFileId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/templateDtl/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditRight,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgEditRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditRight);
  };
  //TODO
  function dlgDtlRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    zUtil.formClear(IdDlgEditRight + ' form');
    zUtil.readonlyAll(IdDlgEditRight);
          
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgEditRight);
    };
    var dlgOptions = {
      title: TitleRight + '-详情',
      onOpen : function(){
        var params = {};
        params['templateFileId']  = row['templateFileId'];
        zUtil.ajaxPost(zGlobal["http"] + "/autocode/templateDtl/detail", {reqData:params}
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            zUtil.valAll(IdDlgEditRight,result[zConst["resData"]]);
        });
      }
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit(IdDlgEditRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgEditRight);
  };
  //TODO
  function dlgDelRight(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableRight,row);
      row = zUtil.tableRows(IdTableRight);
    }
    
    var params = {}; 
    params['templateFileId']  = row['templateFileId'];
    var reqData = {reqData: params};
    var okfunc = function(){
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/templateDtl/del", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
        }else{
          zUtil.msg('操作失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
    }
    zUtil.msgConfirm("确认删除已选中记录?",okfunc);
  }; 
  
  
  /* --分割------------------------------------------------------------------------------ */
  //TODO
  function dlgFileLeft(row){
      if($.isNumeric(row)){
          zUtil.tableSelected(IdTableLeft,row);
          row = zUtil.tableRows(IdTableLeft);
      }
      zUtil.formClear(IdDlgFileLeft +' form');
      var paramsx = {};
      paramsx["templateId"] = row.templateId;
      
      var initFileList = function(){
        var setting = {
            data : {
                simpleData : {
                    enable : true
                },
                keep : {
                    parent : true
                },
            },
            edit : {
                enable : true,
                showRenameBtn : false,
                showRemoveBtn : function(treeId, treeNode) {
                    return treeNode['fileInfo']['type'] === "2";
                }
            },
            view : {
                nameIsHTML : true,
                addDiyDom : function(treeId, treeNode) {
                    var tdata = treeNode['fileInfo'];
                    var oprType = tdata['type'];
                    var templateId = tdata['templateId'];
                    var diyObj = $('<button class="btn btn-info ztree-opr-btn" onclick="doDownloadFiles(\''
                            + templateId + '\');">下载</button>');
                    if (oprType === "0") {
                        diyObj.insertAfter($('#' + treeNode.tId + '_a'));
                    }
                },
            },
            callback : {
                //                            onClick : function(event, treeId, treeNode){}
                beforeRemove : function(treeId, treeNode) {
                    var zTreeObj = zUtil.zTreeObj(treeId);
                    var params = {
                        fileName : treeNode.fileInfo.fileName,
                        templateId : row['templateId']
                    };
                    zTreeObj.hideNode(treeNode);
                    zUtil.ajaxPost(zGlobal["http"] + "/autocode/delProjectFiles", {
                        reqData : params
                    }, function(result) {
                        if (zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,
                                zConst["busCode"])) {
                            zTreeObj.showNode(treeNode);
                            zUtil.msg('删除文件失败');
                            return false;
                        }
                        zTreeObj.removeNode(treeNode);
                    });
                    return false;
                },
                onRemove : function(event, treeId, treeNode) {
                    var zTreeObj = zUtil.zTreeObj(treeId);
                    zTreeObj.expandAll(true);
                }
            }
      };
        //树形结构初始化
       var zTreeObj = zUtil.zTreeInit("#tree-code-file", setting, []);

          zUtil.ajaxPost(zGlobal["http"] + "/autocode/getProjectFiles", {reqData:paramsx}
          ,function(result){
              if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
                  zUtil.msg('获取文件失败'+(result.busMsg?'. '+result.busMsg:''));
                  return false;
              }
                  result=result.resData;
                  var filelist = result.fileList;
                  
                  var zNodes = [];
                  for(var i=0;i<filelist.length;i++){
                      var node = filelist[i];
                      node['templateId'] = row['templateId'];
                      var newNode = {
                              id: node.id
                              ,pId: node.parentId
                              ,name: node.fileName
                              ,fileInfo: node
                              ,chkDisabled: true
                              ,nocheck: true
                      };
                      if(node.type === "0"){
                          newNode.open = true;
                      }
                      if(node.type !== "2"){
                          newNode.isParent = true;
                      }
                      zNodes.push(newNode);
                }
                zTreeObj.addNodes(null, zNodes);
          });
      };
      
      var dlgSave = function(){
        if(!zUtil.formCheck(IdDlgFileLeft +' form')){
          return false;
        };
        var options = {
          url: zGlobal["http"] + '/autocode/uploadTemplate',
          type: 'post',
          data: paramsx
        };
        zUtil.ajaxForm(IdDlgFileLeft + ' form', options
        ,function(result){
            if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
              var params = zUtil.valAll(IdDlgQueryLeft);
              zUtil.tableQuery(IdTableLeft,params);
              
              initFileList();
              zUtil.formClear(IdDlgFileLeft +' form');
            }else{
              zUtil.msg('上传失败'+(result.busMsg?'. '+result.busMsg:''));
            }
        });
      };
      var dlgClose = function(){
        zUtil.dialogClose(IdDlgFileLeft);
      };
      
      var dlgOptions = {
          title: TitleLeft + '-上传',
          width: 700,
          height: 500,
          onOpen:function(){
              initFileList();
          }
      };
      var dlgButtonsIdx = [0,1];
      var dlgButtonsFunc =  [dlgSave,dlgClose];
      
      zUtil.dialogInit(IdDlgFileLeft,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
      zUtil.dialogOpen(IdDlgFileLeft);
  }; 
  function doDownloadFiles(templateId){
      var token = zConst['token'] + "=" +getToken();
      window.open(zGlobal["http"] + "/autocode/downloadTemplateZip?templateId=" + templateId+"&"+token);
  }
  
  //TODO
  function dlgLoadFile(row){
    if($.isNumeric(row)){
      zUtil.tableSelected(IdTableLeft,row);
      row = zUtil.tableRows(IdTableLeft);
    }else{
        row = getTableLeft();
        if(row == null){
          return false;
        };
    }
    zUtil.formClear(IdDlgFileRight +' form');
    
    if(row['templatePath'] == null){
        zUtil.msg('未上传文件');
        return false;
    }
    
    var dlgSave = function(){
      var params = zUtil.tableData(IdTableFileRight)["rows"];
      var reqData = {reqData: {'templateDtlList': params} };
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/saveTemplate", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var params = zUtil.valAll(IdDlgQueryRight);
          zUtil.tableQuery(IdTableRight,params);
          zUtil.dialogClose(IdDlgFileRight);
        }else{
          zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
        }
      });
      
    };
    var dlgClose = function(){
      zUtil.dialogClose(IdDlgFileRight);
    };
    var dlgOptions = {
        title: TitleRight + '-快捷新增',
        onOpen:function(){
          var buttonsIdxFile = [0,3,7];
          var buttonsFuncFile = [tableEditAddFile,tableEditDelFile,tableEditRejectFile];
          var optionsFile = {
                  data : {total:0,rows:[]},
                  idField: 'templateFileId',
                  columns:[[
                      {field: 'templateFileId', title: '模板明细ID', align: 'center', hidden: true },
                      {field: 'templateId', title: '模板主键ID', align: 'center', hidden: true },
                      {field: 'projectId', title: '所属项目', align: 'center', hidden: true },
                      {field: 'moduleId', title: '所属模块', align: 'center', hidden: true },
                      {field: 'fileName', title: '文件名称', align: 'center', width: 300, editor: {type:'textbox',options:{required:true,prompt:'真实文件名称'}} },
                      {field: 'fileTitle', title: '标题', align: 'center', width: 220, editor: {type:'textbox',options:{required:true,prompt:'例如：controller，impl...'}} },
                      {field: 'quoteTag', title: '引用名', align: 'center', width: 160, editor: {type:'textbox',options:{required:true,validType : ['letterNum'],prompt:'controller，impl...忽略填N'} }},
                      {field: 'outputFileFormat', title: '文件格式', align: 'center', width: 100, editor: {type:'textbox',options:{required:true,validType : ['letterNum'],prompt:'java，js...忽略填N'}} },
                      {field: 'outputType', title: '模板类型', align: 'center', width: 120
                          , formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOfAutocode(value,"template.outputType")}
                          ,editor:{type:'combobox'
                                ,options:{panelHeight: 220,required:true, data: zUtil.dataFormat(zDictAutocode['template.outputType'],0)}
                            },
                      },
                      {field: 'orderNum', title: '排序', align: 'center', width: 50, editor: {type:'textbox',options:{required:true,validType : ['number'],prompt:'0'}} },
                  ]],
                  frozenColumns:[[
                  {field:'buttonArr', title:'操作', align:'center', width: 60 },
                  ]],
                  onClickCell: function(rowIndex, field, value){
                      tableEditStartFile(field,rowIndex);
                  },
                  onClickRow: function(rowIndex,rowData){
                      var editObjs = zUtil.table('#table-file-right',"getEditors",rowIndex);
                      $.each(editObjs, function(idx,item){
                          if(rowData['fileName']){
                              if(item.field === "fileName"){
                                  zUtil.readonly($(item.target));
                              }
                          }
                    });
                  }
          };
          zUtil.tableInit2(IdTableFileRight,optionsFile,buttonsIdxFile,buttonsFuncFile);

          var paramsx = {};
          paramsx['templateId'] = row['templateId'];
          zUtil.ajaxPost(zGlobal["http"] + "/autocode/loadTemplate", {reqData:paramsx}
          ,function(result){
            if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
              zUtil.msg('获取信息失败');
              return false;
            }
            var templateData = result[zConst["resData"]];
            var filedata = {total:0,rows:[]};
            if("undefined" !== $.type(templateData) && templateData['templateDtlList'] != null){
              filedata.total = templateData['templateDtlList'].length;
              filedata.rows = templateData['templateDtlList'];
            }
            zUtil.tableData(IdTableFileRight,filedata);
          });
        }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit(IdDlgFileRight,dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen(IdDlgFileRight);
    
  };
  
  //TODO
  function tableEditStartFile(field,rowIndex){
      tableEditAcceptFile();
      IdTableFileEditIdx2 = rowIndex;
      if("buttonArr" != field){
          zUtil.tableSelected(IdTableFileRight,rowIndex);
          zUtil.table(IdTableFileRight,'begine',rowIndex);
          IdTableFileEditIdx = rowIndex;
      }else{
        tableEditAcceptFile();
        IdTableFileEditIdx = rowIndex;
      }
  }
  function tableEditAddFile(){
      if (tableEditAcceptFile()){
          var rowLeft = getTableLeft();
          if(rowLeft == null){
              return false;
          };
          var nrow = {templateFileId:zUtil.uuid(),templateId: rowLeft['templateId'], projectId: rowLeft['projectId'],
                  moduleId: rowLeft['moduleId'], outputType: '1' };
          zUtil.table(IdTableFileRight,"apdrow",nrow);
          IdTableFileEditIdx = zUtil.table(IdTableFileRight,'getrows').length - 1;
          zUtil.tableSelected(IdTableFileRight,IdTableFileEditIdx);
          zUtil.table(IdTableFileRight,'begine',IdTableFileEditIdx);
          IdTableFileEditIdx2 = -1;
      }
  }
  function tableEditDelFile(){
      if (IdTableFileEditIdx == null && IdTableFileEditIdx2 == null){
          return;
      }
      if(IdTableFileEditIdx2 == null){
          IdTableFileEditIdx2 == IdTableFileEditIdx;
      }
      if(IdTableFileEditIdx2 != -1 && IdTableFileEditIdx2 >= 0){
          zUtil.table(IdTableFileRight,'cancele',IdTableFileEditIdx2);
          zUtil.table(IdTableFileRight,'delrow',IdTableFileEditIdx2);
      }
      
      IdTableFileEditIdx = null;
  }
  function tableEditAcceptFile(){
      if (IdTableFileEditIdx == null){return true};
      var flag = zUtil.table(IdTableFileRight,'vldrow',IdTableFileEditIdx);
      if (flag){
          zUtil.table(IdTableFileRight,'accepte');
          return true;
      } else {
          tableEditRejectFile();
          zUtil.msg("未填必填项");
          return false;
      }
  }
  function tableEditRejectFile(){
      zUtil.table(IdTableFileRight,'rejecte');
      IdTableFileEditIdx = null;
  }
  
  function dlgOnlineLookCode(row){
      if($.isNumeric(row)){
          zUtil.tableSelected(IdTableRight,row);
          row = zUtil.tableRows(IdTableRight);
      }else if('object' === $.type(row)){
        
      }
      
      var templateParamMap ={};
      var templateParamMap2 ={};
      zUtil.ajaxPost(zGlobal["http"] + "/autocode/getTemplateParamList", {}
      ,function(templateParamList){
        if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(templateParamList,zConst["busCode"])){
            templateParamList = [];
        }else{
            templateParamList = templateParamList[zConst["resData"]].paramsList;
            var arr =[]
            $.each(templateParamList,function(i,item){
                  templateParamMap["${"+item.paramName+"}"] = [];
                  templateParamMap2["${"+item.paramName+"}"]=item.paramDesc;
            })
        }
      });
      
      function displayHandler(text,displayInfo,displayTitle){
          return {
              text:text,
              displayText: text,
              displayInfo: displayInfo,
              displayTitle: displayTitle,
              render: function(element, self, data) {
                  let div = document.createElement("div");
                  div.setAttribute("class", "autocomplete-div");
                  if(data.displayTitle){
                      div.setAttribute("title", data.displayTitle);
                  }
                  let divText = document.createElement("div");
                  divText.setAttribute("class", "autocomplete-name");
                  divText.innerText = data.displayText;
                  div.appendChild(divText);
                  
                  if(data.displayInfo && data.displayInfo !== data.displayText){
                      let divInfo = document.createElement("div");
                      divInfo.setAttribute("class", "autocomplete-hint");
                      divInfo.innerText = data.displayInfo;
                      
                      let divInfoHidden = document.createElement("div");
                      divInfoHidden.setAttribute("class", "autocomplete-hidden");
                      divInfoHidden.innerText = "&nbsp;"+data.displayInfo;
                      divText.appendChild(divInfoHidden);
                      div.appendChild(divInfo);
                  }
                  element.appendChild(div);
            }
          };
      }
      function hintFunc(cmInstance, hintOptions) {
          const modeObj = cmInstance.doc.getMode();
          let helperType = null;
          if(modeObj.helperType){
              helperType = modeObj.helperType;
          }
          else if(modeObj.innerMode){
              helperType = modeObj.innerMode(modeObj.startState()).mode.helperType;
          }
          else if(modeObj.name){
              helperType = modeObj.name;
          }
          
          let cursor = cmInstance.getCursor();
          let cursorLine = cmInstance.getLine(cursor.line);
          let end = cursor.ch;
          let start = end;
          let token = cmInstance.getTokenAt(cursor);
          
          let list = [];
          var i = 0;
          if(cursorLine.indexOf('${') != -1){
              let cursorBefore = cursorLine.charAt(start - 1);
              var pflag = false;
              while(i<start && !pflag){
                  cursorBefore = cursorLine.charAt(start - 2-i) + cursorBefore;
                  if(new RegExp("[\\s\\}\\.\\:<>]").test(cursorBefore)){
                      break;
                  }
                  pflag = (cursorBefore.indexOf('${') != -1);
                  i = i + 1;
              }
              if (pflag) {
                  cursorBefore = cursorBefore.toLowerCase();
                  if(cursorBefore.indexOf("_") != -1){
                      cursorBefore = cursorBefore.split("_")[0]+"_";
                  }
                  $.each(hintOptions.tables,function(k,v){
                      if(k.indexOf(cursorBefore) != -1){
                          var t=displayHandler(k,templateParamMap2[k]?templateParamMap2[k]:"",k);
                          list.push(t);
//                           list.push(k);
                      }
                  });
              }
          }
          if(list.length === 0 && helperType != null){
              let cursorBefore = cursorLine.charAt(start - 1);
              if(!(new RegExp("[\\s\\n\\r\\t]").test(cursorBefore)) && (new RegExp("[\\w_\\.\\:<>]").test(cursorBefore))){
                  let fromlist = null;
                  if(CodeMirror.hint[helperType]){
                      fromlist = CodeMirror.hint[helperType](cmInstance, hintOptions);
                  }else if (words = cmInstance.getHelper(cmInstance.getCursor(), "hintWords")) {
                      fromlist = CodeMirror.hint.fromList(cmInstance, {words: words});
                  }
                  if(!fromlist || fromlist.list.length === 0){
                      fromlist = CodeMirror.hint.anyword(cmInstance, hintOptions);
                  }
                  return fromlist;
              }
          }
          if(i>1){
            i = 2;
          }
          return {
              list: list,
              from: {ch: token.start-i, line: cursor.line},
              to: {ch: token.end, line: cursor.line}
          };
      }

      var JSInfoDlgEditor = null;
      
      var dlgSave = function(){
           var content = JSInfoDlgEditor.getValue();
           
           var reqData = {reqData: {"templateFileId": row['templateFileId'], "fileContent": content} };
           zUtil.ajaxPost(zGlobal["http"] + "/autocode/saveTemplateContent", reqData
           ,function(result){
              if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
                zUtil.dialogClose('#dlg-code-online-look');
              }else{
                zUtil.msg('保存失败'+(result.busMsg?'. '+result.busMsg:''));
              }
           });
      };
      var dlgClose = function(){
        zUtil.dialogClose('#dlg-code-online-look');
      };
      var dlgOptions = {
         title: '在线编辑',
         onOpen:function(){
             var editorObj = $('#dlg-code-online-look #fileContent').next('.CodeMirror');
             if(editorObj.length === 0){
                JSInfoDlgEditor = CodeMirror.fromTextArea($('#dlg-code-online-look #fileContent')[0], {
                     autoRefresh:true,
                     lineNumbers: true,
                     styleActiveLine: true,
                     matchBrackets: true,
                     lineWrapping: true,
                     theme: 'dracula',
                     hintOptions: {
                         completeSingle: false,  //关闭补全
                         tables: templateParamMap,
                         hint: hintFunc
                     },
                     extraKeys: {
                         "F11": function(cm) {
                           cm.setOption("fullScreen", !cm.getOption("fullScreen"));
                         },
                         "Esc": function(cm) {
                           if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
                         }
                    }
                });
                JSInfoDlgEditor.setSize('100%','100%');
                JSInfoDlgEditor.on('keyup', () => {
                    //编译器内容更改事件
                    JSInfoDlgEditor.showHint();
                });
             }else{
                JSInfoDlgEditor = editorObj[0].CodeMirror;
             }
            
             var type = row['outputFileFormat'];
             var mode = "htmlmixed";
             if(type === 'css'){
                 mode = "text/css";
             }
             else if(type === 'js'){
                 mode = "text/javascript";
             }
             else if(type === 'java'){
                 mode = "text/x-java";
             }
             else if(type === 'xml' || type === 'sql'){
                 mode = "text/x-pgsql";
             }else if(type === 'json'){
                 mode = "application/json";
             }else{
                  mode = "text/x-java";
             }
             JSInfoDlgEditor.setOption("mode", mode);
             
             var paramsx = {};
              paramsx['templateFileId'] = row['templateFileId'];
              zUtil.ajaxPost(zGlobal["http"] + "/autocode/getTemplateContent", {reqData:paramsx}
              ,function(detail){
                if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(detail,zConst["busCode"])){
                  zUtil.msg('获取信息失败');
                  return false;
                }
                JSInfoDlgEditor.setValue(detail[zConst["resData"]]['fileContent']);
              });
         }
      };
      var dlgButtonsIdx = [0,1];
      var dlgButtonsFunc =  [dlgSave,dlgClose];
      zUtil.dialogInit('#dlg-code-online-look',dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
      zUtil.dialogOpen('#dlg-code-online-look');
  }
  
  </script>

</body>
</html>